const tableConfig = {
	stripe: true,
	border: true,
	maxHeight: '80vh',
	columns: [
		{
			label: '表名称',
			prop: 'tableName',
		},
		{
			label: '配置名称',
			prop: 'name',
		},
		{
			label: '数据级别',
			prop: 'dataLevel',
		},
		{
			label: '是否判重',
			prop: 'isRepetition',
		},
		{
			label: '是否启用',
			prop: 'isUse',
		},
		{
			label: '版本号',
			prop: 'versionNumber',
		},
		{
			label: '操作',
			prop: 'menu',
			width: 330,
			fixed: 'right'
		},
	],
}

export const formConfig = {
	inline: false,
	labelPosition: 'left',
	showBtn: true,
	showReset: true,
	backBtnText: '重置',
	column: [
		{
			label: '表名称',
			prop: 'tableName',
			type: 'input',
			span: 24,
			rules: [
				{
					required: true,
					message: '请输入表名称',
					trigger: 'blur',
				}
			]
		},
		{
			label: '配置名称',
			prop: 'name',
			type: 'input',
			span: 24,
			rules: [
				{
					required: true,
					message: '请输入配置名称',
					trigger: 'blur',
				}
			]
		},
		{
			label: '数据级别',
			prop: 'dataLevel',
			type: 'input',
			span: 24
		},
		{
			label: '是否判重',
			prop: 'isRepetition',
			type: 'radio',
			dicData: [
				{
					label: '否',
					value: 0
				},
				{
					label: '是',
					value: 1
				}
			],
			span: 24,
			rules: [
				{
					required: true,
					message: '请选择是否判重',
					trigger: 'change',
				}
			]
		},
		{
			label: '是否启用',
			prop: 'isUse',
			type: 'radio',
			dicData: [
				{
					label: '停用',
					value: 0
				},
				{
					label: '启用',
					value: 1
				}
			],
			span: 24,
			rules: [
				{
					required: true,
					message: '请选择是否启用',
					trigger: 'change',
				}
			]
		},
		{
			label: '版本号',
			prop: 'versionNumber',
			type: 'number',
			span: 8,
			min: 1,
			max: 3,
			rules: [
				{
					required: true,
					message: '请输入版本号',
					trigger: 'blur',
				}
			]
		},
	],
}
const searchConfig = {
	inline: true,
	// 	showBtn: true,
	// 	labelPosition: 'left',
	column: [
		{
			label: '表名称',
			prop: 'tableName',
			type: 'input',
			span: 8,
		},
		// {
		// 	label: '配置名称',
		// 	prop: 'name',
		// 	type: 'input',
		// 	span: 8,
		// },
		// {
		// 	label: '是否判重',
		// 	prop: 'isRepetition',
		// 	type: 'select',
		// 	dicData: [
		// 		{
		// 			label: '否',
		// 			value: 0
		// 		},
		// 		{
		// 			label: '是',
		// 			value: 1
		// 		}
		// 	],
		// 	span: 8
		// },
		// {
		// 	label: '是否启用',
		// 	prop: 'isUse',
		// 	type: 'select',
		// 	dicData: [
		// 		{
		// 			label: '停用',
		// 			value: 0
		// 		},
		// 		{
		// 			label: '启用',
		// 			value: 1
		// 		}
		// 	],
		// 	span: 8
		// },
	],
}
export const detailConfig = {
	inline: false,
	labelPosition: 'left',
	labelWidth: '200px',
	showBtn: false,
	column: [
		{
			custome: 'HtmlLabel',
			prop: 'policyTitle',
			flag: 'bgTitle',
			labelPosition: 'top',
			span: 24,
		},
		{
			label: '发文字号',
			prop: 'policyArticleCode',
			labelPosition: 'left',
			span: 8,
		},
		{
			label: '关键词',
			prop: 'policyKeywords',
			labelPosition: 'left',
			span: 8,
		},
		{
			label: '来源层级',
			prop: 'fromLevel',
			propName: 'fromLevelLabel',
			type: 'remoteSelect',
			code: 'POLICY_LEVEL',
			api: 'getDictItemList',
			labelPosition: 'left',
			span: 8,
		},
		{
			label: '来源单位名称',
			prop: 'fromName',
			labelPosition: 'left',
			span: 8,
		},
		{
			label: '来源单位区划',
			prop: 'areasName',
			custome: 'tag',
			tagType: 'success',
			labelPosition: 'left',
			span: 8,
		},
		{
			label: '养老业务标签',
			prop: 'policyTags',
			propName: 'policyTagsLabels',
			type: 'remoteSelect',
			code: 'POLICY_TAGS',
			api: 'getDictItemList',
			labelPosition: 'left',
			span: 8,
		},
		{
			label: '适应层级',
			prop: 'adaptiveHierarchyLabel',
			custome: 'tag',
			tagType: 'success',
			labelPosition: 'left',
			span: 8,
		},
		{
			label: '适应老人年龄',
			prop: 'ageRange',
			custome: 'tag',
			tagType: 'warning',
			labelPosition: 'left',
			span: 8,
		},
		{
			label: '老人类别',
			prop: 'oldmanType',
			propName: 'oldmanTypeLabel',
			type: 'remoteSelect',
			code: 'ELDERLY_TYPE',
			api: 'getDictItemList',
			labelPosition: 'left',
			span: 8,
		},
		{
			label: '政策正文',
			labelPosition: 'top',
			prop: 'policyContent',
			showWordLimit: true,
			type: 'ueditor',
			height: '20rem',
			span: 24,
		},
		{
			label: '附件',
			prop: 'policyAttachment',
			type: 'upload',
			span: 24,
		},
	],
}
export const baseConfig: any = {
	pageName: '元数据配置',
	addLabel: '新增',
	// dictcodes: [],
	rowKey: 'id',
	tipLabel: 'tableName',
	api: {
		index: 'view_tableConfig_page',
		add: 'view_tableConfig_add',
		// export: 'view_ofsSubsidyApply_approval_exportApply'
		edit: 'view_tableConfig_edit',
		delete: 'view_tableConfig_del',
	},
	auth: {
		index: 'view_tableConfig_page',
		add: 'view_tableConfig_add',
		// mulitSet: 'mulitSet',
		edit: 'view_tableConfig_edit',
		delete: 'view_tableConfig_del',
	},

	menuBtn: [
		
		{
			icon: '',
			label: '配置元数据字段',
			type: 'primary',
			operate: 'fieldConfig',
			auth: 'view_ofsSubsidyApply_view',
			text: true,
			show: true,
		},
		{
			icon: '',
			label: '编辑',
			type: 'primary',
			operate: 'edit',
			auth: 'view_ofsSubsidyApply_view',
			text: true,
			show: true,
		},
		// {
		// 	icon: 'detail',
		// 	label: '查看',
		// 	type: 'primary',
		// 	operate: 'Detail',
		// 	auth: 'view_dpPolicyDocument_page',
		// 	text: true,
		// 	show: true,
		// },
		{
			icon: 'delete',
			label: '删除',
			type: 'danger',
			operate: 'delete',
			auth: 'view_dpPolicyDocument_del',
			text: true,
			show: true,
		}
	],
	dialogConfig: {
		width: '50%',
	},
	// beforeOnLoadFormate: async (query) => {
	// 	return new Promise((resolve, reject) => {
	// 		const crAreasObj: any = getAreaObj(query.authAreas, '')
	// 		resolve({
	// 			...query,
	// 			...crAreasObj,
	// 			authAreas: undefined,
	// 		})
	// 	})
	// },
	// onLoadFormate: async (arr) => {
	// 	const tableData = arr.map((item) => {
	// 		const tempAge = item.ageRange.split(',')
	// 		item.age = `${tempAge[0]} - ${tempAge[1]}`
	// 		item.policyContent = revertUTF8(item.policyContent) 
	// 		return {
	// 			...item,
	// 		}
	// 	})
	// 	return Promise.resolve(Object.freeze(tableData))
	// },
	// saveFormate: async (form: any) => {
	// 	form.policyContent = EncodeUtf8(form.policyContent)
	// 	return new Promise((resolve, reject) => {
	// 		const areasObj: any = getAreaObj(form.areas, 'from')
	// 		const areasNameObj: any = getAreaObj(form.areasName, 'from')
	// 		form.adaptiveHierarchy = form.adaptiveHierarchy.join(',')
	// 		form.policyLevel = 1
	// 		form.policyLevelLabel = '国家级'
	// 		form.module = '1'
	// 		form.moduleLabel = '一站办'
	// 		if (form.adaptiveHierarchyLabel) {
	// 			const temp = form.adaptiveHierarchyLabel.split('/')
	// 			form.adaptiveHierarchyLabel = temp[temp.length - 1]
	// 		}
	// 		const params = {
	// 			...form,
	// 			...areasObj,
	// 			...areasNameObj,
	// 			areas: undefined,
	// 			areasName: undefined,
	// 			code: 3011,
	// 		}
	// 		resolve(params)
	// 	})
	// },
	searchConfig,
	tableConfig,
	formConfig,
	detailConfig
}
